 
<?php $user = $this->user->get();
$condition ="";

if($this->user->is_role(3))
{

	$condition = "and  allocations.user_id =".$user["user_id"];
}


$sql ="SELECT 
	    lpad(material_requests.mr_id, 5,'0') AS `code`,
		material_requests.detail, 
		material_requests.place_id, 
		material_requests.user_id, 
		date_format(material_requests.create_date,'%d/%m/%Y') as create_date, 
		users.firstname, 
		users.lastname, 
		users.position, 
		place.place_name
	FROM material_requests INNER JOIN users ON material_requests.user_id = users.user_id
		 INNER JOIN place ON material_requests.place_id = place.place_id where  mr_id =  $id";

$rows = $this->db->query($sql)->result_array();
$row = $rows[0];
//print_r($rows);
?>
<table class="list">
<tr>
<th style="width: 120px;" >เลขที่สำรวจ</th>
<th><?php echo $row['code'];  ?></th>
</tr>
<tr>
<td>วันที่ขอกรอกสำรวจ</td>
<td><?php echo $row['create_date'];  ?></td>
</tr>
<tr>
<td>ชื่อ-นามสกุล</td>
<td><?php echo $row['firstname']." ".$row["lastname"];  ?></td>
</tr>

<tr>
	<td>รายละเอียด/หมายเหตุ</td>
	<td><?php echo $row['detail'];  ?></td>
</tr>
<tr>
	<td>ห้องปฎิบัติการ/สถานที่</td>
	<td><?php echo $row['place_name'];  ?></td>
</tr>
</table>
